<?php
class AddAction extends Action{
	/*Ajax验证表单,*/
	public function checkForm(){
		if(md5($_POST['verify']) != $_SESSION['verify']) exit('-1');
		$content = trim($_POST['content']);
		$video = trim($_POST['video']);
		if(empty($content) && empty($_POST['pic']) && empty($video)) exit('-3');
		if(count(explode(' ',trim($_POST['tag'])))>3) exit('-4');
		if(!empty($_POST['pic']) && !empty($video)) exit('-5');
		if(!empty($video) && !in_array(array_pop(explode('.',$video)),array('swf','flv')) && !get_headers($video)) exit('-6');
		if(!empty($_POST['email']) && !preg_match("/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i",$_POST['email'])) exit('-7');
	}
}
?>